﻿<%@ WebHandler Language="C#" Class="ShowListPreliminary" %>

using System;
using System.Web;
using System.Text;
using System.Data;
using Chenxin.Lib.Utility;
using Chenxin.Lib.Business;
using Chenxin.Lib.Business.BLL;

public class ShowListPreliminary : AjaxHandlerBase
{
    /// <summary>
    /// 基本权限项
    /// </summary>
    public ShowListPreliminary()
    {

        //修改预审
        htTypePermit.Add("updpreliminary", Constants.Permit_UpdPreliminary);
        //外接预审申请
        htTypePermit.Add("qz", Constants.Permit_QZ);
        //回复预审
        htTypePermit.Add("replypreliminary", Constants.Permit_ReplyPreliminary);
        //预约贷款
        htTypePermit.Add("addloan", Constants.Permit_AddLoan);
        //修改预约
        htTypePermit.Add("updloan", Constants.Permit_UpdLoan);
        //回复预约
        htTypePermit.Add("replyloan", Constants.Permit_ReplyLoan);
        //预审详情
        htTypePermit.Add("viewpreliminaryinfo", Constants.Permit_ViewAllPreliminaryInfo);
        //撤销预审
        htTypePermit.Add("deletepreliminary", Constants.Permit_DeletePreliminary);
        //恢复撤销
        htTypePermit.Add("resumeloan", Constants.Permit_ResumeLoan);
        //导出
        htTypePermit.Add("export", Constants.Permit_Preliminary_Export); 
    }

    override public void RequestProcess(HttpContext context)
    {
        context.Response.AddHeader("pragma", "no-cache");
        context.Response.AddHeader("cache-control", "");
        context.Response.CacheControl = "no-cache";
        string strOp = context.Request["op"];
        string strResponse = "";
        switch (strOp.ToLower())
        {
            //获取实体
            case "getmodel":
                strResponse = GetModel(context);
                break;
            //查询
            case "search":
                strResponse = Search(context);
                break;
            //查询
            case "searchcustomer":
                strResponse = SearchCustomer(context);
                break;
            //回复预审
            case "replypreliminary":
                strResponse = ReplyPreliminary(context);
                break;
            //预约贷款
            case "addloan":
                strResponse = AddLoan(context);
                break;
            //修改预约
            case "updloan":
                strResponse = UpdLoan(context);
                break;
            //回复预约
            case "replyloan":
                strResponse = ReplyLoan(context);
                break;
            //撤销预审
            case "deletepreliminary":
                strResponse = DelPre(context);
                break;
            //恢复撤销
            case "resumeloan":
                strResponse = ResPre(context);
                break;
            default:
                break;
        }
        context.Response.Write(strResponse);
    }

    /// <summary>
    /// 获取实体
    /// </summary>
    /// <param name="context"></param>
    /// <returns></returns>
    private string GetModel(HttpContext context)
    {
        try
        {
            Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo model = null;

            model = Chenxin.Lib.Business.DAL.t_Preliminary_BaseInfo.GetModel(new Guid(context.Request["modelid"]));

            if (model != null)
            {
                return retExecResult(Constants.ExecResult.Succ, "数据不存在，获取信息成功！", model);
            }
            else
            {
                return retExecResult(Constants.ExecResult.Error, "数据不存在，获取信息失败！", "");
            }
        }
        catch (Exception ex)
        {
            return retExecResult(Constants.ExecResult.Error, ex.Message, "");
        }
    }

    //*******************************************
    //功能概要       ：获得预审一览
    //参数説明       ：context 请求的上下文
    //返回值説明     ：无
    //功能詳細       ：获得预审一览
    //作成者         ：zou.xiaochun
    //作成日         ：2010-07-14
    //*******************************************
    private string Search(HttpContext context)
    {
        try
        {
            //页码
            int strPageIndex = (string.IsNullOrEmpty(context.Request["pageindex"])) ? 1 : int.Parse(context.Request["pageindex"]) + 1;
            //页显示行数
            int strPageSize = (string.IsNullOrEmpty(context.Request["pagesize"])) ? 15 : int.Parse(context.Request["pagesize"]);
            //查询条件
            string sqlWhere = GenerateCondition(context);
            
            //查询分页信息
            Chenxin.Lib.Business.BLL.PreliminaryBaseInfo bllPre = new Chenxin.Lib.Business.BLL.PreliminaryBaseInfo();
            System.Data.DataSet ds = bllPre.GetModelListByCoditions(sqlWhere, strPageIndex, strPageSize);
            
            //总页数
            int count = (int)ds.Tables[1].Rows[0][0];
            return string.Format("{{success:'1',msg:'{0}',data:{{count:'{1}',{2}}}}}", Resources.Message.Global_Msg_SUCCESS, count, JsonHelp.Convert2Json(ds.Tables[0]));
        }
        catch (Exception ex)
        {
            return string.Format("{{success:'0',msg:'{0}：{1}',data:''}}", Resources.Message.Global_Err_Exception, ex.Message);
        }
    }

    //*******************************************
    //功能概要       ：获得合同备注一览
    //参数説明       ：context 请求的上下文
    //返回值説明     ：无
    //功能詳細       ：获得合同备注
    //作成者         ：zou.xiaochun
    //作成日         ：2010-11-01
    //*******************************************
    private string SearchCustomer(HttpContext context)
    {
        try
        {
            //页码
            int strPageIndex = (string.IsNullOrEmpty(context.Request["pageindex"])) ? 1 : int.Parse(context.Request["pageindex"]) + 1;
            //页显示行数
            int strPageSize = (string.IsNullOrEmpty(context.Request["pagesize"])) ? 10 : int.Parse(context.Request["pagesize"]);
            //查询条件
            string sqlWhere = GenerateCustomer(context);

            //查询分页信息
            Chenxin.Lib.Business.BLL.PreBuyerInfo bllPreBuyerInfo = new Chenxin.Lib.Business.BLL.PreBuyerInfo();
            System.Data.DataSet ds = bllPreBuyerInfo.getCustomerList(sqlWhere, strPageIndex, strPageSize);
            //总页数
            int count = (int)ds.Tables[1].Rows[0][0];

            return string.Format("{{success:'1',msg:'{0}',data:{{count:'{1}',{2}}}}}", Resources.Message.Global_Msg_SUCCESS, count, JsonHelp.Convert2Json(ds.Tables[0]));
        }
        catch (Exception ex)
        {
            return string.Format("{{success:'0',msg:'{0}：{1}',data:''}}", Resources.Message.Global_Err_Exception, ex.Message);
        }
    }

    //*******************************************
    //功能概要       ：查询权限
    //参数説明       ：context 请求上下文
    //返回值説明     ：程序处理信息提示
    //功能詳細       ：生成查询条件语句
    //作成者         ：chen.yugong
    //作成日         ：2010-06-29
    //修改者         ：王玮
    //修改日         ：2010-07-13
    //*******************************************
    public string GenerateCustomer(HttpContext context)
    {
        try
        {
            string contractid = context.Request["modelid"];
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append(" (1=1) ");
            sb.AppendFormat(" and MainId = '{0}'", contractid);
            return sb.ToString();
        }
        catch (Exception ex)
        {
            return string.Format("{{success:'0',msg:'{0}：{1}',data:''}}", Resources.Message.Global_Err_Exception, ex.Message);
        }
    }
    
    //*******************************************
    //功能概要       ：查询权限
    //参数説明       ：context 请求上下文
    //返回值説明     ：程序处理信息提示
    //功能詳細       ：生成查询条件语句
    //作成者         ：chen.yugong
    //作成日         ：2010-06-29
    //修改者         ：王玮
    //修改日         ：2010-07-13
    //*******************************************
    public string GenerateCondition(HttpContext context)
    {
        try
        {
            //获取页面查询条件
            Guid city = (string.IsNullOrEmpty(context.Request["cityid"])) ? Guid.Empty : new Guid(context.Request["cityid"]);
            Guid company = (string.IsNullOrEmpty(context.Request["companyid"])) ? Guid.Empty : new Guid(context.Request["companyid"]);
            Guid businessdistrict = (string.IsNullOrEmpty(context.Request["areaid"])) ? Guid.Empty : new Guid(context.Request["areaid"]);
            Guid departs = (string.IsNullOrEmpty(context.Request["departid"])) ? Guid.Empty : new Guid(context.Request["departid"]);
            Guid employee = (string.IsNullOrEmpty(context.Request["userid"])) ? Guid.Empty : new Guid(context.Request["userid"]);
            string starttime = context.Request.QueryString["DateFr"];
            string endtime = context.Request.QueryString["DateTo"];
            string keyword = context.Request.QueryString["KeyWord"];
            string strDateType = context.Request["DateType"];
            string strPreliminaryStatus = context.Request["PreliminaryStatus"];
            string strOperateQuanZ = context.Request["OperateQuanZ"];
            string strOrderPlace = context.Request["OrderPlace"];

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            
            //判断级联菜单
            if (employee != Guid.Empty)
                sb.AppendFormat(" and (AppEmployeeId = '{0}') ", employee);
            else if (departs != Guid.Empty)
                sb.AppendFormat(" and (AppDepartId = '{0}')", departs);
            else if (businessdistrict != Guid.Empty)
            {
                Chenxin.Lib.Hr.Entity.Hr_DepartmentInfo item = null;
                string strCachkey = string.Format(Chenxin.Lib.Cache.CacheDataType.GLOBAL_DEPARTMENT, businessdistrict);
                Chenxin.Lib.Cache.CacheService cs = new Chenxin.Lib.Cache.CacheService(Chenxin.Lib.Cache.CacheConn.xCacheConn.GLOBAL);
                item = cs.GetObject<Chenxin.Lib.Hr.Entity.Hr_DepartmentInfo>(strCachkey);
                if (!cs.Hit)
                {
                    item = Chenxin.Lib.Hr.DAL.Hr_DepartmentInfo.GetModel(businessdistrict);
                    if (item != null) cs.Set(strCachkey, item, DateTime.Now.AddDays(1));
                }

                if (item == null) return string.Format("{{success:'0',msg:'{0}',data:''}}", Resources.Message.Global_Err_GetBusDis);

                sb.AppendFormat(" and (AppDepartId in (select departId from v_Hr_DepartmentInfo where DepartSrc like '{0}%'))", item.DepartSrc);
            }
            else if (company != Guid.Empty)
            {
                sb.AppendFormat(" and AppCompanyId = '{0}'", company);
            }
            else if (city != Guid.Empty)
            {
                sb.AppendFormat(" and AppCityId = '{0}'", city);
            }
            else
            {
                sb.AppendFormat(" and AppCompanyId = '{0}'", CurrentUserInfo.CompanyId);
            }

            //查询权限判断权限
            System.Text.StringBuilder sb1 = new System.Text.StringBuilder();
            if (CurrentUserInfo.ContainsPermit(Constants.Permit_PreliminarySearch_All))
            {
                sb1.Append(" (1=1) ");
            }
            else if (CurrentUserInfo.ContainsPermit(Constants.Permit_PreliminarySearch_City))
            {
                sb1.AppendFormat(" (AppCityId = '{0}')", CurrentUserInfo.CityId);
            }
            else if (CurrentUserInfo.ContainsPermit(Constants.Permit_PreliminarySearch_Company))
            {
                sb1.AppendFormat(" (AppCompanyId = '{0}')", CurrentUserInfo.CompanyId);
            }
            else if (CurrentUserInfo.ContainsPermit(Constants.Permit_PreliminarySearch_Depart))
            {
                sb1.Append(" (EXISTS(");
                sb1.AppendFormat("Select 1 from t_Business_EmpSetting M WHERE a.AppDepartId=M.DepartId And M.Userid= '{0}' and SearchPreliminary=1", CurrentUserInfo.UserId.ToString());
                sb1.Append(")) ");
            }
            else
            {
                sb1.AppendFormat(" (AppEmployeeId = '{0}')", CurrentUserInfo.UserId);
            }

            if (!String.IsNullOrEmpty(sb.ToString()))
                sb1.Append(sb.ToString());

            //日期类型+日期
            if (!String.IsNullOrEmpty(strDateType))
            {
                switch (strDateType)
                {
                    case "预审提交":
                        //预审申请开始
                        if (!String.IsNullOrEmpty(starttime))
                        {
                            sb1.Append(string.Format(" and convert(varchar(10),(convert(datetime,a.PreliminaryApplyDate,120)),120)  >= '{0}'", (starttime)));
                        }
                        //预审申请结束
                        if (!String.IsNullOrEmpty(endtime))
                        {
                            sb1.Append(string.Format(" and convert(varchar(10),(convert(datetime,a.PreliminaryApplyDate,120)),120)  <= '{0}'", (endtime)));
                        }
                        break;
                    case "预审回复":
                        //预审回复开始
                        if (!String.IsNullOrEmpty(starttime))
                        {
                            sb1.Append(string.Format(" and convert(varchar(10),(convert(datetime,a.ReplyPreliminaryDate,120)),120)  >= '{0}'", (starttime)));
                        }
                        //预审回复结束
                        if (!String.IsNullOrEmpty(endtime))
                        {
                            sb1.Append(string.Format(" and convert(varchar(10),(convert(datetime,a.ReplyPreliminaryDate,120)),120)  <= '{0}'", (endtime)));
                        }
                        break;
                    case "预约提交":
                        //预约申请开始
                        if (!String.IsNullOrEmpty(starttime))
                        {
                            sb1.Append(string.Format(" and convert(varchar(10),(convert(datetime,a.LoanApplyDate,120)),120)  >= '{0}'", (starttime)));
                        }
                        //预约申请结束
                        if (!String.IsNullOrEmpty(endtime))
                        {
                            sb1.Append(string.Format(" and convert(varchar(10),(convert(datetime,a.LoanApplyDate,120)),120)  <= '{0}'", (endtime)));
                        }
                        break;
                    case "预约回复":
                        //预约回复开始
                        if (!String.IsNullOrEmpty(starttime))
                        {
                            sb1.Append(string.Format(" and convert(varchar(10),(convert(datetime,a.LoanReplyDate,120)),120)  >= '{0}'", (starttime)));
                        }
                        //预约回复结束
                        if (!String.IsNullOrEmpty(endtime))
                        {
                            sb1.Append(string.Format(" and convert(varchar(10),(convert(datetime,a.LoanReplyDate,120)),120)  <= '{0}'", (endtime)));
                        }
                        break;
                }
            }

            //流程
            if (!String.IsNullOrEmpty(strPreliminaryStatus))
            {
                //switch (strPreliminaryStatus)
                //{
                //    case "0":
                //        sb1.Append(" And a.PreliminaryStatus = '0'");
                //        break;
                //    case "10":
                //        sb1.Append(" And a.PreliminaryStatus = '10'");
                //        break;
                //    case "20":
                //        sb1.Append(" And a.PreliminaryStatus = '20'");
                //        break;
                //    case "30":
                //        sb1.Append(" And a.PreliminaryStatus = '30'");
                //        break;
                //    case "40":
                //        sb1.Append(" And a.PreliminaryStatus = '40'");
                //        break;
                //    case "50":
                //        sb1.Append(" And a.PreliminaryStatus = '50'");
                //        break;
                //    case "60":
                //        sb1.Append(" And a.PreliminaryStatus = '60'");
                //        break;
                //    case "70":
                //        sb1.Append(" And a.PreliminaryStatus = '70'");
                //        break;
                //    case "80":
                //        sb1.Append(" And a.PreliminaryStatus = '80'");
                //        break;
                //    case "90":
                //        sb1.Append(" And a.PreliminaryStatus = '90'");
                //        break;
                //}
                switch (strPreliminaryStatus)
                {
                    case "0":
                        sb1.Append(" And a.PreliminaryStatus = '0'");
                        break;
                    case "10":
                        sb1.Append(" And (a.PreliminaryStatus = '10' or a.PreliminaryStatus = '20') ");
                        break;
                    case "30":
                        sb1.Append(" And a.PreliminaryStatus = '30'");
                        break;
                    case "40":
                        sb1.Append(" And (a.PreliminaryStatus = '40' or a.PreliminaryStatus = '50') ");
                        break;
                    case "60":
                        sb1.Append(" And a.PreliminaryStatus = '60'");
                        break;
                }
            }
            else
            {
                sb1.Append(" And a.PreliminaryStatus <> '0'");
            }

            //来源
            if (!String.IsNullOrEmpty(strOperateQuanZ))
            {
                sb1.AppendFormat(" And a.OperateQuanZ = '{0}'", strOperateQuanZ);
            }

            //签约地点
            if (!String.IsNullOrEmpty(strOrderPlace))
            {
                sb1.AppendFormat(" And a.OrderPlace = '{0}'", strOrderPlace);
            }

            //关键字
            if (!String.IsNullOrEmpty(keyword))
            {
                sb1.AppendFormat(" And ((a.Address LIKE '%{0}%') Or(b.CustomerName like '%{0}%'))", keyword);
            }

            return sb1.ToString();
        }
        catch (Exception ex)
        {
            return string.Format("{{success:'0',msg:'{0}：{1}',data:''}}", Resources.Message.Global_Err_Exception, ex.Message);
        }
    }

    //*******************************************
    //功能概要       ：回复预审
    //参数説明       ：context 请求的上下文
    //返回值説明     ：无
    //功能詳細       ：回复预审
    //作成者         ：zou.xiaochun
    //作成日         ：2010-07-14
    //*******************************************
    private string ReplyPreliminary(HttpContext context)
    {
        //预审申请信息
        string preliminary = context.Request.Params["model"];

        //预审信息业务类
        Chenxin.Lib.Business.BLL.PreliminaryBaseInfo bllPreliminary = new Chenxin.Lib.Business.BLL.PreliminaryBaseInfo();

        //预审信息
        Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo entPreliminary =
            (Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo)JsonHelp.Convert2Entity(preliminary,
                    typeof(Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo));

        entPreliminary = CompletePreliminary(entPreliminary, "回复预审");

        //预审信息录入
        bllPreliminary.Update(entPreliminary);
        string text = CurrentUserInfo.UserName + "：预审回复。房源：[" + entPreliminary.HouseCode + "]" + entPreliminary.Address;
        AddLog(text, BusinessType.BusinessTypeComboList()["OprType_ReplyPreliminary"].ToString());
        return retExecResult(Constants.ExecResult.Succ, Resources.Message.Msg_Reply_PreliminarySucc, "");
    }

    //*******************************************
    //功能概要       ：预约贷款
    //参数説明       ：context 请求的上下文
    //返回值説明     ：无
    //功能詳細       ：预约贷款
    //作成者         ：zou.xiaochun
    //作成日         ：2010-07-15
    //*******************************************
    private string AddLoan(HttpContext context)
    {
        //预审申请信息
        string preliminary = context.Request.Params["model"];

        //预审信息业务类
        Chenxin.Lib.Business.BLL.PreliminaryBaseInfo bllPreliminary = new Chenxin.Lib.Business.BLL.PreliminaryBaseInfo();
        
        //预审信息
        Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo entPreliminary =
            (Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo)JsonHelp.Convert2Entity(preliminary,
                    typeof(Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo));

        entPreliminary = CompletePreliminary(entPreliminary, "预约贷款");

        //①预审信息录入
        bllPreliminary.Update(entPreliminary);
        string text = CurrentUserInfo.UserName + "：预约贷款。房源：[" + entPreliminary.HouseCode + "]" + entPreliminary.Address;
        AddLog(text, BusinessType.BusinessTypeComboList()["OprType_AddLoan"].ToString());
        return retExecResult(Constants.ExecResult.Succ, Resources.Message.Msg_add_LoanSucc, "");
    }

    //*******************************************
    //功能概要       ：修改预约
    //参数説明       ：context 请求的上下文
    //返回值説明     ：无
    //功能詳細       ：修改预约
    //作成者         ：zou.xiaochun
    //作成日         ：2010-07-15
    //*******************************************
    private string UpdLoan(HttpContext context)
    {
        //预审申请信息
        string preliminary = context.Request.Params["model"];

        //预审信息业务类
        Chenxin.Lib.Business.BLL.PreliminaryBaseInfo bllPreliminary = new Chenxin.Lib.Business.BLL.PreliminaryBaseInfo();

        //预审信息
        Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo entPreliminary =
            (Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo)JsonHelp.Convert2Entity(preliminary,
                    typeof(Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo));

        entPreliminary = CompletePreliminary(entPreliminary, "修改预约");

        //①预审信息录入
        bllPreliminary.Update(entPreliminary);
        string text = CurrentUserInfo.UserName + "：修改预约。房源：[" + entPreliminary.HouseCode + "]" + entPreliminary.Address;
        AddLog(text, BusinessType.BusinessTypeComboList()["OprType_AddLoan"].ToString());
        return retExecResult(Constants.ExecResult.Succ, Resources.Message.Msg_Update_LoanSucc, "");
    }

    //*******************************************
    //功能概要       ：回复预约
    //参数説明       ：context 请求的上下文
    //返回值説明     ：无
    //功能詳細       ：回复预约
    //作成者         ：zou.xiaochun
    //作成日         ：2010-07-15
    //*******************************************
    private string ReplyLoan(HttpContext context)
    {
        //预审申请信息
        string preliminary = context.Request.Params["model"];

        //预审信息业务类
        Chenxin.Lib.Business.BLL.PreliminaryBaseInfo bllPreliminary = new Chenxin.Lib.Business.BLL.PreliminaryBaseInfo();

        //预审信息
        Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo entPreliminary =
            (Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo)JsonHelp.Convert2Entity(preliminary,
                    typeof(Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo));

        entPreliminary = CompletePreliminary(entPreliminary, "回复预约");

        //①预审信息录入
        bllPreliminary.Update(entPreliminary);
        string text = CurrentUserInfo.UserName + "：回复预约。房源：[" + entPreliminary.HouseCode + "]" + entPreliminary.Address;
        AddLog(text, BusinessType.BusinessTypeComboList()["OprType_UpdLoan"].ToString());
        return retExecResult(Constants.ExecResult.Succ, Resources.Message.Msg_Reply_LoanSucc, "");
    }

    //*******************************************
    //功能概要       ：撤销预审
    //参数説明       ：context 请求的上下文
    //返回值説明     ：无
    //功能詳細       ：撤销预审
    //作成者         ：zou.xiaochun
    //作成日         ：2010-07-15
    //*******************************************
    private string DelPre(HttpContext context)
    {
        //预审信息业务类
        Chenxin.Lib.Business.BLL.PreliminaryBaseInfo bllPreliminary = new Chenxin.Lib.Business.BLL.PreliminaryBaseInfo();

        //贷款处理业务类
        PreLoanInfo bllPreLoan = new PreLoanInfo();
        
        //预审信息
        Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo entPreliminary = new Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo();
        Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo entOldPreliminary = bllPreliminary.GetModel(new Guid(context.Request["modelid"]));
        Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 entPreLoan = new Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3();
        
        if (entOldPreliminary == null || entOldPreliminary.PreliminaryStatus == 0)
        {
            return retExecResult(Constants.ExecResult.Error, "此预审已经被撤销！", "");
        }
        entPreliminary.RecordId = new Guid(context.Request["modelid"]);
        entPreliminary = CompletePreliminary(entPreliminary, "撤销预审");
        string strRecordId = entPreliminary.RecordId.ToString();
        entPreLoan = CompleteDelLoan(entPreLoan, strRecordId);

        //①预审信息录入
        bllPreliminary.Update(entPreliminary);
        bllPreLoan.Update(entPreLoan);
        string text = CurrentUserInfo.UserName + "：撤销预审。房源：[" + entPreliminary.HouseCode + "]" + entPreliminary.Address;
        AddLog(text, BusinessType.BusinessTypeComboList()["OprType_DelPre"].ToString());
        return retExecResult(Constants.ExecResult.Succ, Resources.Message.Msg_Del_PreliminarySucc, "");
    }

    //*******************************************
    //功能概要       ：恢复撤销
    //参数説明       ：context 请求的上下文
    //返回值説明     ：无
    //功能詳細       ：恢复撤销
    //作成者         ：zou.xiaochun
    //作成日         ：2010-08-03
    //*******************************************
    private string ResPre(HttpContext context)
    {
        //预审申请信息
        string preliminary = context.Request.Params["model"];

        //预审信息业务类
        Chenxin.Lib.Business.BLL.PreliminaryBaseInfo bllPreliminary = new Chenxin.Lib.Business.BLL.PreliminaryBaseInfo();

        //贷款处理业务类
        //PreLoanInfo bllPreLoan = new PreLoanInfo();

        //预审信息
        Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo entPreliminary = new Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo();

        //贷款处理
        //Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 entPreLoan = new Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3();

        Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo entOldPreliminary = bllPreliminary.GetModel(new Guid(context.Request["modelid"]));
        if (entOldPreliminary.PreliminaryStatus != 0)
        {
            return retExecResult(Constants.ExecResult.Error, "此预审并没有被撤销！", "");
        }
        entPreliminary.RecordId = new Guid(context.Request["modelid"]);
        entPreliminary = CompletePreliminary(entPreliminary, "恢复撤销");
        
        //①预审信息录入
        bllPreliminary.Update(entPreliminary);
        string text = CurrentUserInfo.UserName + "：恢复撤销。房源：[" + entPreliminary.HouseCode + "]" + entPreliminary.Address;
        AddLog(text, BusinessType.BusinessTypeComboList()["OprType_ResPre"].ToString());
        return retExecResult(Constants.ExecResult.Succ, Resources.Message.Msg_Res_PreliminarySucc, "");
    }

    ////*******************************************
    ////功能概要       ：转化为翻页结构体格式
    ////参数説明       ：dtData 要转化的原始数据
    ////               ：intShowRows 一页所要显示的条数
    ////               ：intCurPage 当前的页码
    ////               ：intTotal 数据总条数
    ////返回值説明     ：翻页结构体
    ////功能詳細       ：转化为翻页结构体格式
    ////作成者         ：zou.xiaochu
    ////作成日         ：2010-07-14 
    ////*******************************************
    //public Constants.Pagination GetJson(System.Data.DataSet dsData)
    //{
    //    Constants.Pagination stuPag = new Constants.Pagination();
    //    System.Data.DataRow row;
    //    DateTime dtTempTime;
    //    int intStatus = 0;

    //    System.Text.StringBuilder strData = new System.Text.StringBuilder();

    //    for (int idxRow = 0; idxRow < dsData.Tables[0].Rows.Count; idxRow++)
    //    {
    //        row = dsData.Tables[0].Rows[idxRow];

    //        strData.AppendFormat("<dl id=\"{0}\">", row["RecordId"].ToString());
    //        strData.AppendFormat("<dd style=\"display: none;\">{0}</dd>", row["RecordId"].ToString());
    //        intStatus = int.Parse(row["PreliminaryStatus"].ToString());
    //        if (intStatus < 30)
    //        {
    //            strData.Append("<dd style=\"text-align:center;\">&nbsp;<input type=\"checkbox\" name=\"IsPreliminaryReply\" onclick=\"return false\" /></dd>");
    //            strData.Append("<dd style=\"text-align:center;\">&nbsp;<input type=\"checkbox\" name=\"IsLoan\" onclick=\"return false\" /></dd>");
    //            strData.Append("<dd style=\"text-align:center;\">&nbsp;<input type=\"checkbox\" name=\"IsLoanReply\" onclick=\"return false\" /></dd>");
    //        }
    //        else if (intStatus == 30)
    //        {
    //            strData.Append("<dd style=\"text-align:center;\">&nbsp;<input type=\"checkbox\" name=\"IsPreliminaryReply\" onclick=\"return false\" checked/></dd>");
    //            strData.Append("<dd style=\"text-align:center;\">&nbsp;<input type=\"checkbox\" name=\"IsLoan\" onclick=\"return false\" /></dd>");
    //            strData.Append("<dd style=\"text-align:center;\">&nbsp;<input type=\"checkbox\" name=\"IsLoanReply\" onclick=\"return false\" /></dd>");
    //        }
    //        else if (intStatus == 40 || intStatus == 50)
    //        {
    //            strData.Append("<dd style=\"text-align:center;\">&nbsp;<input type=\"checkbox\" name=\"IsPreliminaryReply\" onclick=\"return false\" checked/></dd>");
    //            strData.Append("<dd style=\"text-align:center;\">&nbsp;<input type=\"checkbox\" name=\"IsLoan\" onclick=\"return false\" checked/></dd>");
    //            strData.Append("<dd style=\"text-align:center;\">&nbsp;<input type=\"checkbox\" name=\"IsLoanReply\" onclick=\"return false\" /></dd>");
    //        }
    //        else if (intStatus >= 60)
    //        {
    //            strData.Append("<dd style=\"text-align:center;\">&nbsp;<input type=\"checkbox\" name=\"IsPreliminaryReply\" onclick=\"return false\" checked/></dd>");
    //            strData.Append("<dd style=\"text-align:center;\">&nbsp;<input type=\"checkbox\" name=\"IsLoan\" onclick=\"return false\" checked/></dd>");
    //            strData.Append("<dd style=\"text-align:center;\">&nbsp;<input type=\"checkbox\" name=\"IsLoanReply\" onclick=\"return false\" checked/></dd>");
    //        }

    //        if (!string.IsNullOrEmpty(row["LoanApplyDate"].ToString()))
    //        {
    //            dtTempTime = (DateTime)row["LoanApplyDate"];
    //            strData.AppendFormat("<dd style=\"text-align:center;\">{0}</dd>", dtTempTime.ToString("yyyy-MM-dd"));
    //        }
    //        else
    //        {
    //            strData.Append("<dd></dd>");
    //        }
    //        strData.AppendFormat("<dd>{0}</dd>", row["OrderPlace"].ToString());
    //        strData.AppendFormat("<dd>{0}</dd>", row["OrderBank"].ToString());
    //        strData.AppendFormat("<dd style=\"text-align:center;\">{0}</dd>", row["CustomerName"].ToString());
    //        strData.AppendFormat("<dd>{0}</dd>", row["IDNum"].ToString());
    //        strData.AppendFormat("<dd>{0}</dd>", row["GJJNum"].ToString());
    //        strData.AppendFormat("<dd>{0}</dd>", row["Address"].ToString());
    //        if (!string.IsNullOrEmpty(row["CompleteYear"].ToString()))
    //        {
    //            strData.AppendFormat("<dd>{0}</dd>", row["CompleteYear"].ToString());
    //        }
    //        else
    //        {
    //            strData.Append("<dd></dd>");
    //        }

    //        if (!string.IsNullOrEmpty(row["Total_Floor"].ToString()))
    //        {
    //            strData.AppendFormat("<dd>{0}</dd>", row["Total_Floor"].ToString());
    //        }
    //        else
    //        {
    //            strData.Append("<dd></dd>");
    //        }

    //        if (!string.IsNullOrEmpty(row["BuildingArea"].ToString()))
    //        {
    //            strData.AppendFormat("<dd>{0}</dd>", row["BuildingArea"].ToString());
    //        }
    //        else
    //        {
    //            strData.Append("<dd></dd>");
    //        }
    //        strData.AppendFormat("<dd>{0}</dd>", row["BuildingType"].ToString());
    //        if (!string.IsNullOrEmpty(row["GJJmoney"].ToString()))
    //        {
    //            strData.AppendFormat("<dd>{0}</dd>", row["GJJmoney"].ToString());
    //        }
    //        else
    //        {
    //            strData.Append("<dd></dd>");
    //        }
    //        strData.AppendFormat("<dd>{0}</dd>", row["GJJyear"].ToString());
    //        if (!string.IsNullOrEmpty(row["SYMoney"].ToString()))
    //        {
    //            strData.AppendFormat("<dd>{0}</dd>", row["SYMoney"].ToString());
    //        }
    //        else
    //        {
    //            strData.Append("<dd></dd>");
    //        }
    //        strData.AppendFormat("<dd>{0}</dd>", row["SYYear"].ToString());
    //        if (!string.IsNullOrEmpty(row["SalePrice_T"].ToString()))
    //        {
    //            strData.AppendFormat("<dd>{0}</dd>", row["SalePrice_T"].ToString());
    //        }
    //        else
    //        {
    //            strData.Append("<dd></dd>");
    //        }
    //        if (!string.IsNullOrEmpty(row["EstimatePrice"].ToString()))
    //        {
    //            strData.AppendFormat("<dd>{0}</dd>", row["EstimatePrice"].ToString());
    //        }
    //        else
    //        {
    //            strData.Append("<dd></dd>");
    //        }
    //        if (!string.IsNullOrEmpty(row["LoanTotalMoney"].ToString()))
    //        {
    //            strData.AppendFormat("<dd>{0}</dd>", row["LoanTotalMoney"].ToString());
    //        }
    //        else
    //        {
    //            strData.Append("<dd></dd>");
    //        }
    //        strData.AppendFormat("<dd>{0}</dd>", row["LoanInfo"].ToString());
    //        strData.AppendFormat("<dd>{0}</dd>", row["EmpDepartName"].ToString());
    //        strData.AppendFormat("<dd>{0}</dd>", row["EmployeeName"].ToString());
    //        strData.AppendFormat("<dd>{0}</dd>", row["EmpPhone"].ToString());

    //        string strOperateQuanZ = row["OperateQuanZ"].ToString();
    //        if (strOperateQuanZ == "False")
    //        {
    //            strData.Append("<dd style=\"text-align:center;\">否</dd>");
    //        }
    //        else if (strOperateQuanZ == "True")
    //        {
    //            strData.Append("<dd style=\"text-align:center;\">是</dd>");
    //        }
    //        strData.Append("</dl>");
    //    }

    //    stuPag.count = Convert.ToInt32(dsData.Tables[1].Rows[0][0]);
    //    stuPag.data = strData.ToString();
    //    return stuPag;
    //}

    //*******************************************
    //功能概要       ：填充预审信息字段
    //参数説明       ：context 请求上下文
    //返回值説明     ：预审信息实体
    //功能詳細       ：填充预审信息字段
    //作成者         ：zou.xiaochun
    //作成日         ：2010-07-14
    //*******************************************
    private Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 CompleteDelLoan(Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 entPreLoan,string RecordId)
    {
        Chenxin.Lib.Business.BLL.PreLoanInfo bllPreLoan = new Chenxin.Lib.Business.BLL.PreLoanInfo();
        Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 entOldPreLoan = bllPreLoan.GetModel(new Guid(RecordId));

        if (entOldPreLoan != null)
        {
            entPreLoan.RecordId = entOldPreLoan.RecordId;
            entPreLoan.MainId = entOldPreLoan.MainId;
            entPreLoan.LoanCode = entOldPreLoan.LoanCode;
            entPreLoan.LoanInfo = entOldPreLoan.LoanInfo;
            entPreLoan.Address = entOldPreLoan.Address;
            entPreLoan.LackInfo = entOldPreLoan.LackInfo;
            entPreLoan.SalePrice_T = entOldPreLoan.SalePrice_T;
            entPreLoan.EvaluateFeeDate = entOldPreLoan.EvaluateFeeDate;
            entPreLoan.LoanInfo = entOldPreLoan.LoanInfo;
            entPreLoan.ContractId = entOldPreLoan.ContractId;
            entPreLoan.ContractCode = entOldPreLoan.ContractCode;
            entPreLoan.LoanDealMode = entOldPreLoan.LoanDealMode;
            entPreLoan.EvaluateCorp = entOldPreLoan.EvaluateCorp;
            entPreLoan.EvaluateFee = entOldPreLoan.EvaluateFee;
            entPreLoan.InsuranceCorp = entOldPreLoan.InsuranceCorp;
            entPreLoan.InsuranceFee = entOldPreLoan.InsuranceFee;
            entPreLoan.AgencyFee = entOldPreLoan.AgencyFee;
            entPreLoan.ReceiveBank = entOldPreLoan.ReceiveBank;
            entPreLoan.OutVouchFee = entOldPreLoan.OutVouchFee;
            entPreLoan.VouchFee = entOldPreLoan.VouchFee;
            entPreLoan.LoanXf = entOldPreLoan.LoanXf;
            entPreLoan.LoanXfYear = entOldPreLoan.LoanXfYear;
            entPreLoan.LoanSx = entOldPreLoan.LoanSx;
            entPreLoan.LoanSxYear = entOldPreLoan.LoanSxYear;
            entPreLoan.LoanZy = entOldPreLoan.LoanZy;
            entPreLoan.LoanZyYear = entOldPreLoan.LoanZyYear;
            entPreLoan.BankQueryFee = entOldPreLoan.BankQueryFee;
            entPreLoan.BankManageFee = entOldPreLoan.BankManageFee;
            entPreLoan.Remark = entOldPreLoan.Remark;
            entPreLoan.SLRemark = entOldPreLoan.SLRemark;
            entPreLoan.SHRemark = entOldPreLoan.SHRemark;
            entPreLoan.FKRemark = entOldPreLoan.FKRemark;
            entPreLoan.BankLoanDate = entOldPreLoan.BankLoanDate;
            entPreLoan.ReceiveLoanDate = entOldPreLoan.ReceiveLoanDate;
            entPreLoan.LoanBankSaleComplete = entOldPreLoan.LoanBankSaleComplete;
            entPreLoan.LoanContractDate = entOldPreLoan.LoanContractDate;
            entPreLoan.MortgageClearDate = entOldPreLoan.MortgageClearDate;
            entPreLoan.LoanComplete = entOldPreLoan.LoanComplete;
            entPreLoan.SendToBankDate = entOldPreLoan.SendToBankDate;
            entPreLoan.SHDate = entOldPreLoan.SHDate;
            entPreLoan.SLDate = entOldPreLoan.SLDate;
            entPreLoan.VouchFeeDate = entOldPreLoan.VouchFeeDate;
            entPreLoan.VoucherToBankDate = entOldPreLoan.VoucherToBankDate;
            entPreLoan.BankCompleteDate = entOldPreLoan.BankCompleteDate;
            entPreLoan.CompleteLoanDate = entOldPreLoan.CompleteLoanDate;
            entPreLoan.CertificateDate = entOldPreLoan.CertificateDate;
            entPreLoan.InsuranceFeeDate = entOldPreLoan.InsuranceFeeDate;
            entPreLoan.AgencyFeeDate = entOldPreLoan.AgencyFeeDate;
            entPreLoan.OutVouchFeeDate = entOldPreLoan.OutVouchFeeDate;
            entPreLoan.EndDate = entOldPreLoan.EndDate;
            entPreLoan.EstimReportBackDate = entOldPreLoan.EstimReportBackDate;
            entPreLoan.IsNoEvaluateFee = entOldPreLoan.IsNoEvaluateFee;
            entPreLoan.IdBankReceipt = entOldPreLoan.IdBankReceipt;
            entPreLoan.IdZhuanBen = entOldPreLoan.IdZhuanBen;
            entPreLoan.IsNoAgencyFee = entOldPreLoan.IsNoAgencyFee;
            entPreLoan.IdShouBen = entOldPreLoan.IdShouBen;
            entPreLoan.IsLack = entOldPreLoan.IsLack;
            entPreLoan.UpSLDate = entOldPreLoan.UpSLDate;
            entPreLoan.UpSHDate = entOldPreLoan.UpSHDate;
            entPreLoan.UpFKDate = entOldPreLoan.UpFKDate;
            entPreLoan.EstimatePrice = entOldPreLoan.EstimatePrice;
            entPreLoan.BuildingArea = entOldPreLoan.BuildingArea;
            entPreLoan.CompleteYear = entOldPreLoan.CompleteYear;
            entPreLoan.Total_Floor = entOldPreLoan.Total_Floor;
            entPreLoan.CustomerName = entOldPreLoan.CustomerName;
            entPreLoan.IDNum = entOldPreLoan.IDNum;
            entPreLoan.GJJmoney = entOldPreLoan.GJJmoney;
            entPreLoan.GJJyear = entOldPreLoan.GJJyear;
            entPreLoan.SYMoney = entOldPreLoan.SYMoney;
            entPreLoan.SYYear = entOldPreLoan.SYYear;
            entPreLoan.OrderPlace = entOldPreLoan.OrderPlace;
            entPreLoan.Receipt = entOldPreLoan.Receipt;
            entPreLoan.Mortgage = entOldPreLoan.Mortgage;
            entPreLoan.SaleName = entOldPreLoan.SaleName;
            entPreLoan.SaleIDCard = entOldPreLoan.SaleIDCard;
            entPreLoan.SalerPhone = entOldPreLoan.SalerPhone;
            entPreLoan.BuyerPhone = entOldPreLoan.BuyerPhone;
            entPreLoan.OldLoanBank = entOldPreLoan.OldLoanBank;
            entPreLoan.OldLoanMoney = entOldPreLoan.OldLoanMoney;
            entPreLoan.OldRestMoney = entOldPreLoan.OldRestMoney;
            entPreLoan.EmpCityId = entOldPreLoan.EmpCityId;
            entPreLoan.EmpCityName = entOldPreLoan.EmpCityName;
            entPreLoan.EmpCompanyId = entOldPreLoan.EmpCompanyId;
            entPreLoan.EmpCompanyName = entOldPreLoan.EmpCompanyName;
            entPreLoan.EmpDepartId = entOldPreLoan.EmpDepartId;
            entPreLoan.EmpDepartName = entOldPreLoan.EmpDepartName;
            entPreLoan.EmployeeId = entOldPreLoan.EmployeeId;
            entPreLoan.EmployeeName = entOldPreLoan.EmployeeName;
            entPreLoan.EmpPhone = entOldPreLoan.EmpPhone;
            entPreLoan.SLDate = entOldPreLoan.SLDate;
            entPreLoan.UpSLDate = entOldPreLoan.UpSLDate;
            entPreLoan.SHDate = entOldPreLoan.SHDate;
            entPreLoan.UpSHDate = entOldPreLoan.UpSHDate;
            entPreLoan.FKDate = entOldPreLoan.FKDate;
            entPreLoan.UpFKDate = entOldPreLoan.UpFKDate;
            entPreLoan.Status = 0;
            entPreLoan.OperateCompanyId = CurrentUserInfo.CompanyId;
            entPreLoan.OperateCompanyName = CurrentUserInfo.CompanyName;
            entPreLoan.OperateDepartId = CurrentUserInfo.DepartId;
            entPreLoan.OperateDepartName = CurrentUserInfo.DepartName;
            entPreLoan.OperateUserId = CurrentUserInfo.UserId;
            entPreLoan.OperateUserName = CurrentUserInfo.UserName;
        }
        return entPreLoan;
    }
        
    //*******************************************
    //功能概要       ：填充预审信息字段
    //参数説明       ：context 请求上下文
    //返回值説明     ：预审信息实体
    //功能詳細       ：填充预审信息字段
    //作成者         ：zou.xiaochun
    //作成日         ：2010-07-14
    //*******************************************
    private Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo CompletePreliminary(Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo entPreliminary, string status)
    {
        //预审贷款信息处理业务类
        Chenxin.Lib.Business.BLL.PreliminaryBaseInfo bllPreliminary = new Chenxin.Lib.Business.BLL.PreliminaryBaseInfo();
        Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo entOldPreliminary = bllPreliminary.GetModel(entPreliminary.RecordId);
        
        
        //回复预审
        if (status.Equals("回复预审"))
        {
            entPreliminary.ReplyPreliminaryDate = DateTime.Now;
            entPreliminary.PreliminaryStatus = 30;
            entPreliminary.LoanApplyDate = entOldPreliminary.LoanApplyDate;
            entPreliminary.OrderPlace = entOldPreliminary.OrderPlace;
            entPreliminary.OrderBank = entOldPreliminary.OrderBank;
            entPreliminary.OrderBeiZhu = entOldPreliminary.OrderBeiZhu;
            entPreliminary.LoanReplyDate = entOldPreliminary.LoanReplyDate;
            entPreliminary.delName = entOldPreliminary.delName;
            entPreliminary.delUserId = entOldPreliminary.delUserId;
            entPreliminary.delTime = entOldPreliminary.delTime;
            entPreliminary.ReplyCompanyId = CurrentUserInfo.CompanyId;
            entPreliminary.ReplyCompanyName = CurrentUserInfo.CompanyName;
            entPreliminary.ReplyDepartId = CurrentUserInfo.DepartId;
            entPreliminary.ReplyDepartName = CurrentUserInfo.DepartName;
            entPreliminary.ReplyUserId = CurrentUserInfo.UserId;
            entPreliminary.ReplyUserName = CurrentUserInfo.UserName;
        }
        else if (status.Equals("预约贷款"))
        {
            entPreliminary.EstimatePrice = entOldPreliminary.EstimatePrice;
            entPreliminary.ProposeBank = entOldPreliminary.ProposeBank;
            entPreliminary.GJJmoney = entOldPreliminary.GJJmoney;
            entPreliminary.GJJyear = entOldPreliminary.GJJyear;
            entPreliminary.SYMoney = entOldPreliminary.SYMoney;
            entPreliminary.SYYear = entOldPreliminary.SYYear;
            entPreliminary.ReplyAdivce = entOldPreliminary.ReplyAdivce;
            entPreliminary.ReplyCompanyId = entOldPreliminary.ReplyCompanyId;
            entPreliminary.ReplyCompanyName = entOldPreliminary.ReplyCompanyName;
            entPreliminary.ReplyDepartId = entOldPreliminary.ReplyDepartId;
            entPreliminary.ReplyDepartName = entOldPreliminary.ReplyDepartName;
            entPreliminary.ReplyUserId = entOldPreliminary.ReplyUserId;
            entPreliminary.ReplyUserName = entOldPreliminary.ReplyUserName;
            entPreliminary.ReplyPreliminaryDate = entOldPreliminary.ReplyPreliminaryDate;
            entPreliminary.OrderBank = entOldPreliminary.OrderBank;
            entPreliminary.OrderBeiZhu = entOldPreliminary.OrderBeiZhu;
            entPreliminary.LoanReplyDate = entOldPreliminary.LoanReplyDate;
            entPreliminary.delName = entOldPreliminary.delName;
            entPreliminary.delUserId = entOldPreliminary.delUserId;
            entPreliminary.delTime = entOldPreliminary.delTime;
            entPreliminary.LoanDate = DateTime.Now;
            entPreliminary.PreliminaryStatus = 40;
        }
        else if (status.Equals("回复预约"))
        {
            entPreliminary.LoanReplyDate = DateTime.Now;
            entPreliminary.EstimatePrice = entOldPreliminary.EstimatePrice;
            entPreliminary.ProposeBank = entOldPreliminary.ProposeBank;
            entPreliminary.GJJmoney = entOldPreliminary.GJJmoney;
            entPreliminary.GJJyear = entOldPreliminary.GJJyear;
            entPreliminary.SYMoney = entOldPreliminary.SYMoney;
            entPreliminary.SYYear = entOldPreliminary.SYYear;
            entPreliminary.ReplyAdivce = entOldPreliminary.ReplyAdivce;
            entPreliminary.ReplyCompanyId = entOldPreliminary.ReplyCompanyId;
            entPreliminary.ReplyCompanyName = entOldPreliminary.ReplyCompanyName;
            entPreliminary.ReplyDepartId = entOldPreliminary.ReplyDepartId;
            entPreliminary.ReplyDepartName = entOldPreliminary.ReplyDepartName;
            entPreliminary.ReplyUserId = entOldPreliminary.ReplyUserId;
            entPreliminary.ReplyUserName = entOldPreliminary.ReplyUserName;
            entPreliminary.ReplyPreliminaryDate = entOldPreliminary.ReplyPreliminaryDate;
            entPreliminary.PreliminaryStatus = 60;
            entPreliminary.LoanApplyDate = entOldPreliminary.LoanApplyDate;
            entPreliminary.OrderPlace = entOldPreliminary.OrderPlace;
            entPreliminary.delName = entOldPreliminary.delName;
            entPreliminary.delUserId = entOldPreliminary.delUserId;
            entPreliminary.delTime = entOldPreliminary.delTime;
            entPreliminary.LoanDate = entOldPreliminary.LoanDate;
        }
        else if (status.Equals("修改预约"))
        {
            entPreliminary.EstimatePrice = entOldPreliminary.EstimatePrice;
            entPreliminary.ProposeBank = entOldPreliminary.ProposeBank;
            entPreliminary.GJJmoney = entOldPreliminary.GJJmoney;
            entPreliminary.GJJyear = entOldPreliminary.GJJyear;
            entPreliminary.SYMoney = entOldPreliminary.SYMoney;
            entPreliminary.SYYear = entOldPreliminary.SYYear;
            entPreliminary.ReplyAdivce = entOldPreliminary.ReplyAdivce;
            entPreliminary.ReplyCompanyId = entOldPreliminary.ReplyCompanyId;
            entPreliminary.ReplyCompanyName = entOldPreliminary.ReplyCompanyName;
            entPreliminary.ReplyDepartId = entOldPreliminary.ReplyDepartId;
            entPreliminary.ReplyDepartName = entOldPreliminary.ReplyDepartName;
            entPreliminary.ReplyUserId = entOldPreliminary.ReplyUserId;
            entPreliminary.ReplyUserName = entOldPreliminary.ReplyUserName;
            entPreliminary.ReplyPreliminaryDate = entOldPreliminary.ReplyPreliminaryDate;
            entPreliminary.OrderBank = entOldPreliminary.OrderBank;
            entPreliminary.OrderBeiZhu = entOldPreliminary.OrderBeiZhu;
            entPreliminary.LoanReplyDate = entOldPreliminary.LoanReplyDate;
            entPreliminary.delName = entOldPreliminary.delName;
            entPreliminary.delUserId = entOldPreliminary.delUserId;
            entPreliminary.delTime = entOldPreliminary.delTime;
            entPreliminary.LoanDate = entOldPreliminary.LoanDate;
            entPreliminary.PreliminaryStatus = 50;
        }
        else if (status.Equals("撤销预审"))
        {
            entPreliminary.delTime = DateTime.Now;
            entPreliminary.delUserId = CurrentUserInfo.UserId;
            entPreliminary.delName = CurrentUserInfo.UserName;
            entPreliminary.LoanApplyDate = entOldPreliminary.LoanApplyDate;
            entPreliminary.EstimatePrice = entOldPreliminary.EstimatePrice;
            entPreliminary.ProposeBank = entOldPreliminary.ProposeBank;
            entPreliminary.GJJmoney = entOldPreliminary.GJJmoney;
            entPreliminary.GJJyear = entOldPreliminary.GJJyear;
            entPreliminary.SYMoney = entOldPreliminary.SYMoney;
            entPreliminary.SYYear = entOldPreliminary.SYYear;
            entPreliminary.ReplyAdivce = entOldPreliminary.ReplyAdivce;
            entPreliminary.ReplyCompanyId = entOldPreliminary.ReplyCompanyId;
            entPreliminary.ReplyCompanyName = entOldPreliminary.ReplyCompanyName;
            entPreliminary.ReplyDepartId = entOldPreliminary.ReplyDepartId;
            entPreliminary.ReplyDepartName = entOldPreliminary.ReplyDepartName;
            entPreliminary.ReplyUserId = entOldPreliminary.ReplyUserId;
            entPreliminary.ReplyUserName = entOldPreliminary.ReplyUserName;
            entPreliminary.ReplyPreliminaryDate = entOldPreliminary.ReplyPreliminaryDate;
            entPreliminary.LoanApplyDate = entOldPreliminary.LoanApplyDate;
            entPreliminary.OrderPlace = entOldPreliminary.OrderPlace;
            entPreliminary.OrderBank = entOldPreliminary.OrderBank;
            entPreliminary.OrderBeiZhu = entOldPreliminary.OrderBeiZhu;
            entPreliminary.LoanReplyDate = entOldPreliminary.LoanReplyDate;
            entPreliminary.PreliminaryStatus = 0;
        }
        else if (status.Equals("恢复撤销"))
        {
            entPreliminary.delTime = entOldPreliminary.delTime;
            entPreliminary.delUserId = entOldPreliminary.delUserId;
            entPreliminary.delName = entOldPreliminary.delName;
            entPreliminary.LoanApplyDate = entOldPreliminary.LoanApplyDate;
            entPreliminary.EstimatePrice = entOldPreliminary.EstimatePrice;
            entPreliminary.ProposeBank = entOldPreliminary.ProposeBank;
            entPreliminary.GJJmoney = entOldPreliminary.GJJmoney;
            entPreliminary.GJJyear = entOldPreliminary.GJJyear;
            entPreliminary.SYMoney = entOldPreliminary.SYMoney;
            entPreliminary.SYYear = entOldPreliminary.SYYear;
            entPreliminary.ReplyAdivce = entOldPreliminary.ReplyAdivce;
            entPreliminary.ReplyCompanyId = entOldPreliminary.ReplyCompanyId;
            entPreliminary.ReplyCompanyName = entOldPreliminary.ReplyCompanyName;
            entPreliminary.ReplyDepartId = entOldPreliminary.ReplyDepartId;
            entPreliminary.ReplyDepartName = entOldPreliminary.ReplyDepartName;
            entPreliminary.ReplyUserId = entOldPreliminary.ReplyUserId;
            entPreliminary.ReplyUserName = entOldPreliminary.ReplyUserName;
            entPreliminary.ReplyPreliminaryDate = entOldPreliminary.ReplyPreliminaryDate;
            entPreliminary.LoanApplyDate = entOldPreliminary.LoanApplyDate;
            entPreliminary.OrderPlace = entOldPreliminary.OrderPlace;
            entPreliminary.OrderBank = entOldPreliminary.OrderBank;
            entPreliminary.OrderBeiZhu = entOldPreliminary.OrderBeiZhu;
            entPreliminary.LoanReplyDate = entOldPreliminary.LoanReplyDate;
            entPreliminary.PreliminaryStatus = 10;
        }

        entPreliminary.RecordId = entOldPreliminary.RecordId;
        entPreliminary.HouseId = entOldPreliminary.HouseId;
        entPreliminary.HouseCode = entOldPreliminary.HouseCode;
        entPreliminary.Address = entOldPreliminary.Address;
        entPreliminary.BuildingArea = entOldPreliminary.BuildingArea;
        entPreliminary.BuildingType = entOldPreliminary.BuildingType;
        entPreliminary.SalePrice_T = entOldPreliminary.SalePrice_T;
        entPreliminary.SalePrice_U = entOldPreliminary.SalePrice_U;
        entPreliminary.CompleteYear = entOldPreliminary.CompleteYear;
        entPreliminary.Total_Floor = entOldPreliminary.Total_Floor;
        entPreliminary.AppCityId = entOldPreliminary.AppCityId;
        entPreliminary.AppCityName = entOldPreliminary.AppCityName;
        entPreliminary.AppCompanyId = entOldPreliminary.AppCompanyId;
        entPreliminary.AppCompanyName = entOldPreliminary.AppCompanyName;
        entPreliminary.AppDepartId = entOldPreliminary.AppDepartId;
        entPreliminary.AppDepartName = entOldPreliminary.AppDepartName;
        entPreliminary.AppEmployeeId = entOldPreliminary.AppEmployeeId;
        entPreliminary.AppEmployeeName = entOldPreliminary.AppEmployeeName;
        entPreliminary.AppEmployeeCode = entOldPreliminary.AppEmployeeCode;
        entPreliminary.PreliminaryCompanyId = entOldPreliminary.PreliminaryCompanyId;
        entPreliminary.PreliminaryCompanyName = entOldPreliminary.PreliminaryCompanyName;
        entPreliminary.PreliminaryDepartId = entOldPreliminary.ReplyDepartId;
        entPreliminary.PreliminaryDepartName = entOldPreliminary.PreliminaryDepartName;
        entPreliminary.LoanTotalMoney = entOldPreliminary.LoanTotalMoney;
        entPreliminary.LoanInfo = entOldPreliminary.LoanInfo;
        entPreliminary.OperateQuanZ = entOldPreliminary.OperateQuanZ;
        entPreliminary.EmpCityId = entOldPreliminary.EmpCityId;
        entPreliminary.EmpCityName = entOldPreliminary.EmpCityName;
        entPreliminary.EmpCompanyId = entOldPreliminary.EmpCompanyId;
        entPreliminary.EmpCompanyName = entOldPreliminary.EmpCompanyName;
        entPreliminary.EmpDepartId = entOldPreliminary.EmpDepartId;
        entPreliminary.EmpDepartName = entOldPreliminary.EmpDepartName;
        entPreliminary.EmployeeId = entOldPreliminary.EmployeeId;
        entPreliminary.EmployeeName = entOldPreliminary.EmployeeName;
        entPreliminary.EmployeeCode = entOldPreliminary.EmployeeCode;
        entPreliminary.EmpPhone = entOldPreliminary.EmpPhone;
        entPreliminary.Receipt = entOldPreliminary.Receipt;
        entPreliminary.Mortgage = entOldPreliminary.Mortgage;
        entPreliminary.SaleName = entOldPreliminary.SaleName;
        entPreliminary.SaleIDCard = entOldPreliminary.SaleIDCard;
        entPreliminary.SaleSpouseeName = entOldPreliminary.SaleSpouseeName;
        entPreliminary.SaleSpouseeIDCard = entOldPreliminary.SaleSpouseeIDCard;
        entPreliminary.OldLoanBank = entOldPreliminary.OldLoanBank;
        entPreliminary.OldLoanMoney = entOldPreliminary.OldLoanMoney;
        entPreliminary.OldRestMoney = entOldPreliminary.OldRestMoney;
        entPreliminary.IsOneYear = entOldPreliminary.IsOneYear;
        entPreliminary.Remark = entOldPreliminary.Remark;
        entPreliminary.PreliminaryApplyDate = entOldPreliminary.PreliminaryApplyDate;
        entPreliminary.PreliminaryDate = entOldPreliminary.PreliminaryDate;
        entPreliminary.ContractId = entOldPreliminary.ContractId;
        entPreliminary.ContractCode = entOldPreliminary.ContractCode;
        entPreliminary.ContractDate = entOldPreliminary.ContractDate;
        entPreliminary.SpecialExp = entOldPreliminary.SpecialExp;
        entPreliminary.OperateCompanyId = CurrentUserInfo.CompanyId;
        entPreliminary.OperateCompanyName = CurrentUserInfo.CompanyName;
        entPreliminary.OperateDepartId = CurrentUserInfo.DepartId;
        entPreliminary.OperateDepartName = CurrentUserInfo.DepartName;
        entPreliminary.OperateUserId = CurrentUserInfo.UserId;
        entPreliminary.OperateUserName = CurrentUserInfo.UserName;
        entPreliminary.LastDate = DateTime.Now;
        return entPreliminary;
    }
}